<extend name="Base/common" />
<block name="header">
<header class="jumbotron subhead" id="overview">
  <div class="container">
    <h2>修改密码</h2>
    <p><span><span class="pull-left"></span> </span></p>
  </div>
</header>
</block>

<block name="side">
    
</block>

<block name="body">
    <div id="main-content">
        <div id="main" class="main" style="min-height: 380px;margin-left:0;">
            <div class="row">
                <h1>修改密码</h1>
                <div class="admin">
                    <i class="admin_icon"></i> {:get_username()}
                </div>
            </div>
            <div class="span12">

                <form class="login-form" action="__SELF__" method="post">
                    <div class="control-group">
                        <label class="item-label" for="inputPassword">原密码</label>
                        <div class="controls">
                            <input class="text " style="width:280px;"  type="text"   class="span3" placeholder="请输入密码"  errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="old">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="item-label" for="inputPassword">新密码</label>
                        <div class="controls">
                            <input  class="text " style="width:280px;"  type="password"   class="span3" placeholder="请输入密码"  errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="item-label" for="inputPassword">确认密码</label>
                        <div class="controls">
                            <input  class="text " style="width:280px;"  type="password" class="span3" placeholder="请再次输入密码" recheck="password" errormsg="您两次输入的密码不一致" nullmsg="请填确认密码" datatype="*" name="repassword">
                        </div>
                        <div class="controls Validform_checktip text-warning"></div>
                    </div>
                    <div class="control-group">
                        <div class="controls">
                            <button style="margin-top:15px;background: #46b643;" type="submit" class="btn">提 交</button>
                            <a href='/' style="margin-top:15px;background: #be4343;"  class="btn" >返 回</a>
                        </div>
                    </div>
                </form>
            </div>

        </div>
    </div>
<section>

</section>
</block>


<block name="script">
	<script type="text/javascript">

    	$(document)
	    	.ajaxStart(function(){
	    		$("button:submit").addClass("log-in").attr("disabled", true);
	    	})
	    	.ajaxStop(function(){
	    		$("button:submit").removeClass("log-in").attr("disabled", false);
	    	});

    	$("form").submit(function(){
    		var self = $(this);
    		$.post(self.attr("action"), self.serialize(), success, "json");
    		return false;

    		function success(data){
    			if(data.status){
    				window.location.href = data.url;
    			} else {

    			    var $error;
                    switch (data.info) {
                        case -1:  $error = '用户名长度必须在16个字符以内！'; break;
                        case -2:  $error = '用户名被禁止注册！'; break;
                        case -3:  $error = '用户名被占用！'; break;
                        case -4:  $error = '密码长度必须在6-30个字符之间！'; break;
                        case -5:  $error = '邮箱格式不正确！'; break;
                        case -6:  $error = '邮箱长度必须在1-32个字符之间！'; break;
                        case -7:  $error = '邮箱被禁止注册！'; break;
                        case -8:  $error = '邮箱被占用！'; break;
                        case -9:  $error = '手机格式不正确！'; break;
                        case -10: $error = '手机被禁止注册！'; break;
                        case -11: $error = '手机号被占用！'; break;
                        default:  $error = '未知错误';
                    }
    				self.find(".Validform_checktip").text($error);
    			}
    		}
    	});
	</script>
</block>
